/***********************************************************************
 * nScreen - An Advanced Console Application Framework for .NET
 * 
 * Copyright (C) 2007 by:
 *  Justin Long (dukk(a)dukk.org)
 *  Fabio Cavalcante (fabio(a)codesapien.com)
 *  Josh Perry (josh(a)6bit.com)
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Library General Public License as 
 * published by  the Free Software Foundation; either version 2 of the 
 * License or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Library General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this package (See COPYING.LIB); if not, write to the 
 * Free Software Foundation, Inc.
 * 59 Temple Place - Suite 330
 * Boston, MA 02111-1307, USA.
 ***********************************************************************/

using System;
using System.Collections.Generic;
using System.Text;

namespace nScreen.Controls
{
	public class VeridicalLine : ScreenControl
	{
		private char _repeteChar = '*';
		private int _length = 3;

		private ConsoleColor? _foregroundColor;
		private ConsoleColor? _backgroundColor;

		public char RepeteChar
		{
			get { return _repeteChar; }
			set { _repeteChar = value; }
		}

		public int Length
		{
			get { return _length; }
			set { _length = value; }
		}

		public ConsoleColor? ForegroundColor
		{
			get { return _foregroundColor; }
			set { _foregroundColor = value; }
		}

		public ConsoleColor? BackgroundColor
		{
			get { return _backgroundColor; }
			set { _backgroundColor = value; }
		}

		protected override void OnRender()
		{
			base.OnRender();

			if (this.ForegroundColor.HasValue)
			{
				Console.ForegroundColor = this.ForegroundColor.Value;
			}

			if (this.BackgroundColor.HasValue)
			{
				Console.BackgroundColor = this.BackgroundColor.Value;
			}

			for (int i = 0; i < this.Length; i++)
			{
				this.SetSafeCursorPosition(this.Left, this.Top + i);
				Console.Write(this.RepeteChar);
			}

			Console.ResetColor();
		}
	}
}
